package com.bh.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author Wang
 * @version 1.0
 * {@code @date} 2022/6/8 14:13
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired(required = false)
    RestTemplate restTemplate;

    @GetMapping("/save")
    public String save(){
        System.out.println("----------保存订单-----------");
        //更新库存
        String rs=  restTemplate.getForObject("http://NEW-STOCK/stock/update",String.class);
        System.out.println("-----更新库存结果："+rs);
        return "订单保存成功";
    }
}
